package com.wgworkshop.pems.controller;

import com.wgworkshop.pems.common.ResponseData;
import com.wgworkshop.pems.model.OssBasicInfo;
import com.wgworkshop.pems.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 阿里云OSS控制器。
 * Created by wlc on 2017/8/31.
 */
@RestController
@RequestMapping("/oss")
public class OssController {
    @Autowired
    private OssService ossService;

    @GetMapping("/basic")
    ResponseData<OssBasicInfo> basic() {
        OssBasicInfo info = ossService.getBasicInfo();
        return new ResponseData<OssBasicInfo>().success(info);
    }

    @GetMapping("/token")
    ResponseData<Map<String, String>> token() {
        Map<String, String> token = ossService.getToken();
        return new ResponseData<Map<String, String>>().success(token);
    }
}
